﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SMSTester
{
    public partial class MainForm : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        #region Initialization
        public MainForm()
        {
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            SomeoneSchemaItemClick(null, new EventArgs() );
            Storage1Generator.GetParams();
            Storage2Generator.GetParams();
            Storage3Generator.GetParams();
            Storage1Generator.TableNameMessage = "Sky_SMSTestStorageMessagesToSMTP";
            Storage1Generator.TableNameMessageBody = "Sky_SMSTestStorageMessagesToSMTPBody";
            Storage2Generator.TableNameMessage = "Sky_SMSTestStorageMessagesFromSMTPToGateway";
            Storage2Generator.TableNameMessageBody = "Sky_SMSTestStorageMessagesFromSMTPToGatewayBody";
            Storage3Generator.TableNameMessage = "Sky_SMSTestStorageMessagesFromGateway";
            Storage3Generator.TableNameMessageBody = "Sky_SMSTestStorageMessagesFromGatewayBody";

            ComparerStorage1Storage3.TableNameFrom = "Sky_SMSTestStorageMessagesToSMTP";
            ComparerStorage1Storage3.TableNameBodyFrom = "Sky_SMSTestStorageMessagesToSMTPBody";
            ComparerStorage1Storage2.TableNameFrom = "Sky_SMSTestStorageMessagesToSMTP";
            ComparerStorage1Storage2.TableNameBodyFrom = "Sky_SMSTestStorageMessagesToSMTPBody";

            ComparerStorage2Storage3.TableNameFrom = "Sky_SMSTestStorageMessagesFromSMTPToGateway";
            ComparerStorage2Storage3.TableNameBodyFrom = "Sky_SMSTestStorageMessagesFromSMTPToGatewayBody";
            ComparerStorage1Storage2.TableNameTo = "Sky_SMSTestStorageMessagesFromSMTPToGateway";
            ComparerStorage1Storage2.TableNameBodyTo = "Sky_SMSTestStorageMessagesFromSMTPToGatewayBody";

            ComparerStorage1Storage3.TableNameTo = "Sky_SMSTestStorageMessagesFromGateway";
            ComparerStorage1Storage3.TableNameBodyTo = "Sky_SMSTestStorageMessagesFromGatewayBody";
            ComparerStorage2Storage3.TableNameTo = "Sky_SMSTestStorageMessagesFromGateway";
            ComparerStorage2Storage3.TableNameBodyTo = "Sky_SMSTestStorageMessagesFromGatewayBody";

            sendMail.GetParams();
            sendMail.TableName = "Sky_SMSTestStorageMessagesToSMTP";
            sendMail.TableNameBody = "Sky_SMSTestStorageMessagesToSMTPBody";

            sendMessageToGeatway.GetParams();
            sendMessageToGeatway.TableName = "Sky_SMSTestStorageMessagesFromSMTPToGateway";
            sendMessageToGeatway.TableNameBody = "Sky_SMSTestStorageMessagesFromSMTPToGatewayBody";
        }

        private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            Storage1Generator.SetParams();
            Storage2Generator.SetParams();
            Storage3Generator.SetParams();
            sendMail.SetParams();
            sendMessageToGeatway.SetParams();
        }
        #endregion

        #region Events
        private void SomeoneSchemaItemClick(object sender, EventArgs e)
        {
            Storage1Generator.Init(siStorage1.Checked);
            Storage2Generator.Init(siStorage2.Checked);
            Storage3Generator.Init(siStorage3.Checked);

            ComparerStorage1Storage3.Init(siStorage1Storage3.Checked);
            ComparerStorage1Storage2.Init(siStorage1Storage2.Checked);
            ComparerStorage2Storage3.Init(siStorage2Storage3.Checked);

            sendMail.Init(siSMTP.Checked);
            sendMessageToGeatway.Init(siGeatway.Checked);
        }

        private void btnShowHideSchema_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // Show/Hide Picture
            pnSchema.Visible = btnShowHideSchema.Checked;
        }
        #endregion



    }
}
